﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Npc : MonoBehaviour {

	public GameObject EShow;

	public GameObject Talk;

	// Use this for initialization
	void Start () {
		
	}

	private void OnTriggerEnter2D(Collider2D collider2d) {
		if (collider2d.gameObject.tag == "Player") {
			EShow.SetActive (true);
		}
	}

	private void OnTriggerStay2D(Collider2D collider2d) {
		if (collider2d.gameObject.tag == "Player") {
			if (Input.GetKeyDown (KeyCode.E)) {
				EShow.SetActive (false);
				Talk.SetActive (true);
			}
		}
	}

	private void OnTriggerExit2D(Collider2D collider2d) {
		if (collider2d.gameObject.tag == "Player") {
			EShow.SetActive (false);
			Talk.SetActive (false);
		}
	}
	
	// Update is called once per frame
	void Update () {
		
	}
}
